|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectga.view.examples.simple.SimpleObjectIndividual
public final class SimpleObjectIndividual
Individual for the simple object example.
Field Summary | |
---|---|
private int |
age
|
private double |
fitness
|
private java.util.List<java.lang.Number> |
genotype
|
private long |
id
|
private static java.util.concurrent.atomic.AtomicLong |
ID_GENERATOR
|
private int |
maxAge
|
static int |
NUM_PARAMETERS
|
static int |
PARAMETER_TYPE
|
static int |
PARAMETERS_COLOR
|
private static java.util.Random |
RND
|
static int |
TYPE_COUNT
|
Fields inherited from interface ga.core.individual.IFitness |
---|
UNEVALUATED |
Constructor Summary | |
---|---|
SimpleObjectIndividual()
Instantiates a new simple object individual. |
Method Summary | |
---|---|
SimpleObjectIndividual |
clone()
Creates a new individual that is equal to this. |
int |
getAge()
Getter for the age. |
float |
getAgeNormalized()
Getter for the normalized age (in [0;1]). |
GAContext |
getContext()
Getter for the GA context. |
double |
getFitness()
Getter for the fitness of the individual. |
java.util.List<java.lang.Number> |
getGenotype()
Gets the genotype. |
long |
getId()
Getter for the unique id. |
int |
getMaxAge()
Gets the maximum age. |
void |
incAge()
Increments the age. |
void |
initRandomly()
Initializes the genotype randomly and resets the fitness. |
boolean |
isEvaluated()
Determines if the individual has been evaluated. |
boolean |
isOld()
Determines if the individual is too old and should die. |
void |
setContext(GAContext context)
Sets the GA context. |
void |
setFitness(double fitness)
Setter for the fitness of the individual. |
void |
setMaxAge(int maxAge)
Setter for the maximum age. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_COUNT
public static final int PARAMETERS_COLOR
public static final int PARAMETER_TYPE
public static final int NUM_PARAMETERS
private static final java.util.Random RND
private static final java.util.concurrent.atomic.AtomicLong ID_GENERATOR
private final long id
private int maxAge
private final java.util.List<java.lang.Number> genotype
private int age
private double fitness
Constructor Detail |
---|
public SimpleObjectIndividual()
Method Detail |
---|
public long getId()
IIndividual
getId
in interface IIndividual<SimpleObjectIndividual>
public void setContext(GAContext context)
IIndividual
setContext
in interface IIndividual<SimpleObjectIndividual>
context
- The contextpublic GAContext getContext()
IIndividual
getContext
in interface IIndividual<SimpleObjectIndividual>
public void initRandomly()
IIndividual
initRandomly
in interface IIndividual<SimpleObjectIndividual>
public void setFitness(double fitness)
IFitness
setFitness
in interface IFitness
fitness
- The fitness.public double getFitness()
IFitness
getFitness
in interface IFitness
public java.util.List<java.lang.Number> getGenotype()
public java.lang.String toString()
toString
in class java.lang.Object
public int getAge()
IAge
getAge
in interface IAge
public void setMaxAge(int maxAge)
IAge
setMaxAge
in interface IAge
maxAge
- The maximum agepublic float getAgeNormalized()
IAge
getAgeNormalized
in interface IAge
public boolean isOld()
IAge
isOld
in interface IAge
public int getMaxAge()
public void incAge()
IAge
incAge
in interface IAge
public boolean isEvaluated()
IIndividual
isEvaluated
in interface IIndividual<SimpleObjectIndividual>
true
if the individual is evaluated.public SimpleObjectIndividual clone()
IIndividual
clone
in interface IIndividual<SimpleObjectIndividual>
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |